﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Xml;

namespace FBA.Client.Utils
{
    public class LanguageResource
    {

        private XmlDataProvider provider = App.Current.TryFindResource("LanguageProvider") as XmlDataProvider;

        public string this[string key]
        {
            get
            {
                try
                {
                    XmlNode node = provider.Document.SelectSingleNode(provider.XPath + "/Entry[@key='" + key + "']");
                    if(node == null)
                    {
                        return "";
                    }
                    else
                    {
                        return node.InnerText;
                    }
                }
                catch(Exception e)
                {
                    return e.Message;
                }
            }
            set
            {}
        }

        private string _fontSize;

        public string FontSize
        {
            get {
                try
                {
                    XmlNode node = provider.Document.SelectSingleNode("/LangSettings/MinFontSize");
                    if (node == null)
                    {
                        return "";
                    }
                    else
                    {
                        return node.InnerText;
                    }
                }
                catch (Exception e)
                {
                    return e.Message;
                }
            }
            set {}
        }

    }
}
